/**
 * Created by seeker910 on 2014/8/18.
 *
 * TTCB top topic content bottom
 */
Rsd.define('Rsd.hermit.pages.Master', {
    extend: 'Rsd.container.Page',
    requires: [
        'Rsd.form.Text',
        'Rsd.control.Grid',
        'Rsd.hermit.sections.TopInfoBarPart',
        'Rsd.hermit.sections.ImageNewsViewPart',
        'Rsd.hermit.sections.HNavigationPart',
        'Rsd.hermit.sections.CopyrightViewPart',
        'Rsd.hermit.sections.ImageNewsViewPart',
        'Rsd.hermit.sections.ScrollListPart',
        'Rsd.hermit.sections.TabContainerViewPart',
        'Rsd.hermit.sections.HNavigationPart',
        'Rsd.hermit.sections.SearchBarViewPart'
    ],
    xtype: 'master-page',
    autoLoad: true,
    sizeUnit: 'px',
    layout: 'vbox',
    items: [
        {
            name: 'float',
            xtype: 'container',
            header: false,
            floating: true,
            fixed: true,
            width: '5rem',
            height: '5rem'
        },
        {
            name: 'top',
            xtype: 'container',
            header: false,
            width: '100%',
            cls: 'x-master-top',
            layout: 'vbox',
            items: [
                {
                    name: "top",
                    xtype: 'top-info-bar',
                    label: false
                },
                {
                    xtype: 'image',
                    label: false,
                    width: '100%',
                    src: './resources/images/topic.png',
                },
                {
                    xtype: 'search-bar-view',
                    header: false,
                    height: 42,
                    width: 300,
                    style: { position: 'absolute', right: '50px', top: '100px' },

                },
                {
                    name: "menu",
                    header: false,
                    xtype: 'h-navigation',
                    dataSource:[
                        { 
                            text:'新闻中心',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{ textAlign:'center',lineHeight:50},
                            flex:100
                        },
                        { 
                            text:'信息公开',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{ textAlign:'center',lineHeight:50},
                            flex:100
                        },
                        { 
                            text:'政务公开',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{ textAlign:'center',lineHeight:50},
                            flex:100
                        },
                        { 
                            text:'法律法规',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{ textAlign:'center',lineHeight:50},
                            flex:100
                        },
                        { 
                            text:'业务办理',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{  textAlign:'center',lineHeight:50},
                            flex:100
                        },
                        { 
                            text:'业主查询',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{ textAlign:'center',lineHeight:50},
                            flex:100
                        },
                        { 
                            text:'互动交流',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{ textAlign:'center',lineHeight:50},
                            flex:100
                        },
                        { 
                            text:'资料中心',
                            cls:'x-menu',
                            margin:'0 25 0 25',
                            style:{textAlign:'center',lineHeight:50},
                            flex:100
                        }
                    ]
                }
            ]
        },
        {
            name: 'content',
            xtype: 'container',
            header: false,
            width: '100%',
            cls: 'x-master-content',
            layout: { type: 'hbox', align: 'left' }
        },
        {
            name: 'bottom',
            xtype: 'container',
            cls: 'x-master-bottom',
            header: false,
            width: '100%',
            items:[ 
                {
                    name: "copyright",
                    xtype: 'copyright-view',
                    header: false,
                    cls: 'x-bottom',
                    height: 150,
                    width: '100%',
                    dataSource: { companyName: '扬中市房屋专项维修资金管理中心', licenseNO: '苏ICP备1305877号' }
                }
            ]
        }
    ],
    /**
     * 
     * @param {*} config 
     */
    constructor: function MasterPage(config) {

        config = config || {};
        this.apply(config);
    }

}, function (type) {
    var _floatGetter = function () {
        return this.items[0];
    };

    var _floatSetter = function (value) {
        if (Rsd.isEmpty(value)) {
            return;
        }
        if (Rsd.isString(value)) {
            this.items[0].xtype = value;
            return;
        }
        if (Rsd.isObject(value)) {
            Rsd.apply(this.items[0], value, 3);
            return;
        }
    }

    this.defineProperty(type, "float", _floatGetter, _floatSetter, true);

    var _topGetter = function () {
        return this.items[1];
    };

    var _topSetter = function (value) {
        if (Rsd.isEmpty(value)) {
            return;
        }
        if (Rsd.isString(value)) {
            this.items[1].xtype = value;
            return;
        }
        if (Rsd.isObject(value)) {
            Rsd.apply(this.items[1], value, 3);
            return;
        }
        if (Rsd.isArray(value)) {
            this.items[1].items = value;
            return;
        }
    }

    this.defineProperty(type, "top", _topGetter, _topSetter, true);

    var _contentGetter = function () {

        return this.items[2];
    };

    var _contentSetter = function (value) {
        if (Rsd.isEmpty(value)) {
            return;
        }
        if (Rsd.isString(value)) {
            this.items[2].xtype = value;
            return;
        }
        if (Rsd.isObject(value)) {
            Rsd.apply(this.items[2], value, 3);
            return;
        }
        if (Rsd.isArray(value)) {
            this.items[2].items = value;
            return;
        }
    }

    this.defineProperty(type, "content", _contentGetter, _contentSetter, true);


    var _bottomGetter = function () {

        return this.items[3];
    };

    var _bottomSetter = function (value) {
        if (Rsd.isEmpty(value)) {
            return;
        }
        if (Rsd.isString(value)) {
            this.items[3].xtype = value;
            return;
        }
        if (Rsd.isObject(value)) {
            Rsd.apply(this.items[3], value, 3);
            return;
        }
        if (Rsd.isArray(value)) {
            this.items[3].items = value;
            return;
        }
    }

    this.defineProperty(type, "bottom", _bottomGetter, _bottomSetter, true);
});
